package Meituan.Feature;

import com.google.common.base.Splitter;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
 * @author: leiwenkang
 * @date: 2020/4/24
 * @time: 19:42
 */
public class FeatureModelPlugin {
    public static void main(String[] args) {
        String str = "city_cac double comment '城市cac',\n" +
                "city_poi_rate double comment '城市新客商家补贴率',\n" +
                "city_mtdp_rate double comment '城市新客美团补贴率',\n" +
                "city_sg_rate double comment '城市新客闪购补贴率',\n" +
                "city_order_uv bigint comment '城市首购用户uv',\n" +
                "city_discount_amt double comment '订单优惠金额',\n" +
                "city_poi_charge_amt double comment '商家承担金额',\n" +
                "city_agent_charge_amt double comment '代理商承担金额',\n" +
                "city_nmd_charge_amt double comment '美团承担金额',\n" +
                "city_outer_channel_charge_amt double comment '外部渠道承担金额',\n" +
                "city_sg_charge_amt double comment '闪购承担金额',\n" +
                "city_original_price double comment '订单原价',\n" +
                "city_actual_price double comment '订单总价',\n" +
                "city_poi_num bigint comment '商家数量',\n" +
                "city_aor_num bigint comment '蜂窝数量'";

        addSgMkt(str);
    }

    private static void addSgMkt(String str) {
        if (StringUtils.isBlank(str)) {
            return;
        }

        List<String> list = Splitter.on("\n").splitToList(str);
        for (String featureValue: list) {
            List<String> featureValueList = Splitter.on(" ").splitToList(featureValue);
            String featureName = featureValueList.get(0).trim();

            System.out.println(featureValue + "#sg_mkt_" + featureName);
        }

    }
}
